package 力扣._8049_判断能否在给定时间到达单元格;

public class Solution {
    public boolean isReachableAtTime(int sx, int sy, int fx, int fy, int t) {
        //到达的最短时间，斜着+水平
        int time = 0;
        int t1 = Math.abs(fy - sy);
        int t2 = Math.abs(sx - fx);
        if(t1==t2&&t1==0&&t==1){    //特殊情况：重合且仅有1秒
            return false;
        }
        time = t1 + t2;
        time -= Math.min(t1, t2);
        return time <= t;
    }
}
